﻿' ----------------------------------------------------------------------------------
' Microsoft Developer & Platform Evangelism
' 
' Copyright (c) Microsoft Corporation. All rights reserved.
' 
' THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
' EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES 
' OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ----------------------------------------------------------------------------------
' The example companies, organizations, products, domain names,
' e-mail addresses, logos, people, places, and events depicted
' herein are fictitious.  No association with any real company,
' organization, product, domain name, email address, logo, person,
' places, or events is intended or should be inferred.
' ----------------------------------------------------------------------------------

Imports Microsoft.Samples.WindowsPhoneCloud.StorageClient
Imports System.Globalization
Imports System.Data.Services.Common

Namespace Models

    <DataServiceEntity(), EntitySet("SampleData")>
    Public Class SampleData
        Inherits TableServiceEntity
        Private nameValue As String
        Private descriptionValue As String
        Private numberValue As Integer
        Private dateValue As Date = Date.Now

        Public Sub New()
            MyBase.New("a", String.Format(CultureInfo.InvariantCulture, "{0:10}_{1}", Date.MaxValue.Ticks - Date.Now.Ticks, Guid.NewGuid()))
        End Sub

        Public Sub New(ByVal partitionKey As String, ByVal rowKey As String)
            MyBase.New(partitionKey, rowKey)
        End Sub

        Public Property Name() As String
            Get
                Return Me.nameValue
            End Get

            Set(ByVal value As String)
                Me.nameValue = value
                Me.OnPropertyChanged("Name")
            End Set
        End Property

        Public Property Description() As String
            Get
                Return Me.descriptionValue
            End Get

            Set(ByVal value As String)
                Me.descriptionValue = value
                Me.OnPropertyChanged("Description")
            End Set
        End Property

        Public Property Number() As Integer
            Get
                Return Me.numberValue
            End Get

            Set(ByVal value As Integer)
                Me.numberValue = value
                Me.OnPropertyChanged("Number")
            End Set
        End Property

        Public Property [Date]() As Date
            Get
                Return Me.dateValue
            End Get

            Set(ByVal value As Date)
                Me.dateValue = value
                Me.OnPropertyChanged("Date")
            End Set
        End Property
    End Class
End Namespace